package xuexi;

class Yongh{
    private String yid;
    private Juese juese[];

    public Juese[] getJuese() {
        return juese;
    }

    public void setJuese(Juese[] juese) {
        this.juese = juese;
    }

    private  String name;

    public String getYid() {
        return yid;
    }

    public void setYid(String yid) {
        this.yid = yid;
    }

    public String getInfo(){
        return "【用户信息】yid="+this.yid+"  name="+this.name;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Yongh(String yid, String name) {
        this.yid = yid;
        this.name = name;
    }
}
class Juese{
    private long jid;
    private String title;
    private Yongh yongh[];
    private Quanxian quanxian[];

    public void setJid(long jid) {
        this.jid = jid;
    }

    public Yongh[] getYongh() {
        return yongh;
    }

    public void setYongh(Yongh[] yongh) {
        this.yongh = yongh;
    }

    public Quanxian[] getQuanxian() {
        return quanxian;
    }

    public void setQuanxian(Quanxian[] quanxian) {
        this.quanxian = quanxian;
    }

    public Long getJid() {
        return jid;
    }

    public void setJid(Long jid) {
        this.jid = jid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Juese(long jid, String title) {
        this.jid = jid;
        this.title = title;
    }


    public String getInfo(){
        return "【角色信息】yid="+this.jid+"  title="+this.title;
    }
}
class Quanxian{
    private Long qid;
    private String title;
    private Juese juese;

    public Juese getJuese() {
        return juese;
    }

    public void setJuese(Juese juese) {
        this.juese = juese;
    }

    public Long getQid() {
        return qid;
    }

    public void setQid(Long qid) {
        this.qid = qid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Quanxian(Long qid, String title) {
        this.qid = qid;
        this.title = title;
    }

    public String getInfo(){
        return "【权限信息】yid="+this.qid+"  title="+this.title;
    }
}
public class nanduoduiudo {
    public  static void main(String[] args){
    Yongh yonghA=new Yongh("101","吴亦凡");
    Yongh yonghB=new Yongh("102","宝宝");
    Juese jueseA=new Juese(1L,"管理员");
    Juese jueseB=new Juese(2L,"普通用户");
    Juese jueseC=new Juese(3L,"游客");
    Quanxian quanxianA=new Quanxian(10001L,"修改学号");
    Quanxian quanxianB=new Quanxian(10002L,"添加学号");
    Quanxian quanxianC=new Quanxian(10003L,"删除学号");
    Quanxian quanxianD=new Quanxian(20001L,"查看学号");
    Quanxian quanxianE=new Quanxian(20002L,"查看成绩");
    Quanxian quanxianF=new Quanxian(30001L,"查看学校");
    Quanxian quanxianG=new Quanxian(30002L,"留言");
    yonghA.setJuese(new Juese[]{jueseA,jueseB,jueseC});
    yonghB.setJuese(new Juese[]{jueseA,jueseC});
    jueseA.setYongh(new Yongh[]{yonghA,yonghB});
    jueseB.setYongh(new Yongh[]{yonghB});
    jueseC.setYongh(new Yongh[]{yonghA,yonghB});
    jueseA.setQuanxian(new Quanxian[]{quanxianA,quanxianB,quanxianC});
    jueseB.setQuanxian(new Quanxian[]{quanxianE,quanxianF});
    jueseC.setQuanxian(new Quanxian[]{quanxianF,quanxianG});
    quanxianA.setJuese(jueseA);
    quanxianB.setJuese(jueseA);
    quanxianC.setJuese(jueseA);
    quanxianD.setJuese(jueseB);
    quanxianE.setJuese(jueseB);
    quanxianF.setJuese(jueseC);
    quanxianG.setJuese(jueseC);
    System.out.println("------通过用户查看信息------");
    System.out.println(yonghA.getInfo());
    for (int x=0;x<yonghA.getJuese().length;x++) {
        System.out.println("\t|-"+yonghA.getJuese()[x].getInfo());
        for (int j=0;j<yonghA.getJuese()[x].getQuanxian().length;j++){
            System.out.println("\t\t|-"+yonghA.getJuese()[x].getQuanxian()[j].getInfo());
        }
    }
    System.out.println("------通过角色查看信息------");
    System.out.println("\t------通过角色查看用户信息------");
    System.out.println(jueseB.getInfo());
    for (int x=0;x<jueseB.getYongh().length;x++){
        System.out.println("\t\t|-"+jueseB.getYongh()[x].getInfo());
    }
    System.out.println("\t------通过角色查看权限信息------");
        for (int x=0;x<jueseB.getQuanxian().length;x++){
            System.out.println("\t\t|-"+jueseB.getQuanxian()[x].getInfo());
        }
    System.out.println("------通过权限查看信息------");
    System.out.println(quanxianA.getInfo());
    for (int z=0;z<quanxianA.getJuese().getYongh().length;z++) {
        System.out.println("\t|-"+quanxianD.getJuese().getYongh()[z].getInfo());
        break;
    }
    }
}
